<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/',"Home\IndexController@index");
Route::get('/test/index',"TestController@index");
Route::get('/article/showlist',"Article\ArticleController@showlist");
Route::get('/article/detail/{id}',"Article\ArticleController@detail");
Route::get('/article/add',"Article\ArticleController@addarticle");
//后台退出
Route::get('/admin/logout',"Auth\LoginController@logout");

//Route::prefix('admin')->namespace('Admin')->group(function () {
//    Route::prefix('article')->group(function () {
//        Route::get('index', 'ArticleController@index');
//        Route::get('create', 'ArticleController@create');
//        Route::post('store', 'ArticleController@store');
//    });
//});

// Home 模块
Route::group(['namespace' => 'Home'], function () {
    // 标签
    Route::get('tag/{id}', 'IndexController@tag');
});

Route::prefix('home')->namespace('Home')->group(function () {
    Route::get('/', 'IndexController@index');

    Route::prefix('index')->group(function () {
        Route::get('index', 'IndexController@index');
        Route::get('article/{id}', 'IndexController@article');
        Route::get('tag/{id}', 'IndexController@tag');
        Route::get('category/{id}', 'IndexController@category');
        Route::post('store', 'IndexController@store');
        Route::get('time', 'IndexController@time');
        Route::post('comment', 'IndexController@comment')->middleware("home.login");
        Route::get('islogin', 'IndexController@islogin');
        Route::get('search', 'IndexController@search');
    });
    Route::prefix('wechat')->group(function () {
        Route::get('code', 'WechatController@code');
        Route::get('getcode', 'WechatController@getcode');
    });
    Route::prefix('thirdlogin')->group(function () {
        Route::get('testLogin', 'ThirdLoginController@testLogin');
        Route::get('github', 'ThirdLoginController@github');
        Route::get('githubcallback', 'ThirdLoginController@githubCallBack');
        Route::get('logout', 'ThirdLoginController@logout');
    });
    Route::prefix('applys')->group(function (){
        Route::get('tankgame','ApplysController@tankgame');
    });
});

Route::prefix('ori_admin')->middleware("admin.login")->namespace('Admin')->group(function () {
    Route::get('/', 'ArticleController@index');

//    Route::prefix('index')->group(function () {
//        Route::get('index', 'IndexController@index');
//        Route::get('create', 'ArticleController@create');
//        Route::post('store', 'ArticleController@store');
//    });
    Route::prefix('article')->group(function () {
        Route::get('index', 'ArticleController@index');
        Route::get('create', 'ArticleController@create');
        Route::get('edit/{id}', 'ArticleController@edit');
        Route::get('destroy/{id}', 'ArticleController@destroy');
        Route::post('store', 'ArticleController@store');
        Route::post('uploadImage', 'ArticleController@uploadImage');
    });
    Route::prefix('category')->group(function () {
        Route::get('index', 'CategoryController@index');
        Route::get('edit/{id}', 'CategoryController@edit');
        Route::get('destroy/{id}', 'CategoryController@destroy');
        Route::post('store', 'CategoryController@store');
    });
    Route::prefix('tag')->group(function () {
        Route::get('index', 'TagController@index');
        Route::get('edit/{id}', 'TagController@edit');
        Route::get('destroy/{id}', 'TagController@destroy');
        Route::post('store', 'TagController@store');
    });
    Route::prefix('chat')->group(function () {
        Route::get('index', 'ChatController@index');
        Route::get('edit/{id}', 'ChatController@edit');
        Route::get('destroy/{id}', 'ChatController@destroy');
        Route::post('store', 'ChatController@store');
    });

});

Auth::routes();

//Route::get('/admin', 'ArticleController@index')->name('admin');
